<template>
	<view>
		<view class="content">
			<view class="list">
				<view class="usersetting" @click="btnimg">
					<!-- <view class="title">头像</view> -->
					<view class="left">
						<image :src="srcUrl||'/static/img/face.jpg'" mode="widthFix"></image>
					</view>
				<view class="right">
					<view class="username" >00</view>
					<view class="signature" >用户名：00</view>
				</view>
				
					<view class="hearIcon">
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<!-- <view class="row">
					<view class="title">昵称</view>
					<view class="right">
						<view class="tis">大黑哥</view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">个性签名</view>
					<view class="right">
						<view class="tis">这人太懒了，什么都不写</view>
						<view class="icon xiangyou"></view>
					</view>
				</view> -->
				<view class="row">
					<view class="title">收货地址</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">账户安全</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
			</view>
			
			<view class="list">
				<view class="row">
					<view class="title">通知提醒</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">支付设置</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">通用</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
			</view>
			<view class="list">
				<view class="row">
					<view class="title">版本升级</view>
					<view class="right">
						<view class="tis">v1.0.0</view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">清除缓存</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">问题反馈</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
				<view class="row">
					<view class="title">关于商城</view>
					<view class="right">
						<view class="tis"></view>
						<view class="icon xiangyou"></view>
					</view>
				</view>
			</view>
		</view>
		<button  class="delBtn">退出登录</button>

		<uni-popup ref="popup" type="dialog">
			<uni-popup-dialog mode="base" content="是否更换图片" :duration="2000" :before-close="true" @close="close"
				@confirm="confirm"></uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				srcUrl:'',
			};
		},
		methods: {
			btnimg() {
				this.$refs.popup.open()
			},
			close() {
				this.$refs.popup.close()
			},
			confirm() {
				//更改图片
				let self =this;
				//前端代码
				uni.chooseImage({
					count: 1,
					success(res) {
						console.log(res);
						if (res.tempFilePaths.length > 0) {
							let filePath = res.tempFilePaths[0]
							console.log(filePath)
							//进行上传操作

							uniCloud.uploadFile({
								filePath: filePath,
								cloudPath: `${Date.now()}.jpg`,
								onUploadProgress: function(progressEvent) {
									var percentCompleted = Math.round(
										(progressEvent.loaded * 100) / progressEvent.total
									);
									console.log(percentCompleted)
								},
								success(res) {
									
									uniCloud.callFunction({
										name:"updateUrl",
										data:{'id':'60efef15b103190001986576','avatar':res.fileID},
										success:data=> {
											console.log(data,'数据')
										}
									})
									self.$refs.popup.close()
								},
								fail(res) {
									console.log(res)
								},
								complete(res) {
									console.log(res)
								}
							});

						}
					}
				});
			},
			showType(tbIndex) {
				this.tabbarIndex = tbIndex;
				this.list = this.orderList[tbIndex];
			}
		}
	}
</script>

<style>
	page {
		background-color: #f3f3f3;
	}
</style>

<style lang="scss" scoped>


	.icon {
		font-size: 30upx;
	}

	.content {
		padding-bottom: 20upx;

		.list {
			width: 96%;
			padding-left: 4%;
			background-color: #fff;
			margin-bottom: 20upx;

			.row {
				widows: 100%;
				min-height: 90upx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: solid 1upx #eee;

				&:last-child {
					border-bottom: none;
				}

				.title {
					font-size: 32upx;
					color: #333;
				}

				.right {
					display: flex;
					align-items: center;
					color: #999;

					.tis {
						font-size: 26upx;
						margin-right: 5upx;
						max-height: 120upx;

						image {
							width: 100upx;
							height: 100upx;
							border-radius: 100%;
							margin: 10upx 0;
						}
					}

					.icon {
						width: 40upx;
						color: #cecece;
					}
				}

			}
		}
	}
	.delBtn{
		margin-top: 20upx;
		border-radius:10upx;
		background-color: #ffffff;
	}

	.usersetting{
		width: 100%;
		display: flex;
		align-items: center;
		padding-bottom: 20upx;
		border-bottom: solid 1upx #eee;
		justify-content: space-between;
		.left{
			width: 20vw;
			height: 20vw;
			flex-shrink: 0;
			margin-right: 20upx;
			border: solid 1upx #fff;
			border-radius: 100%;
			image{
				width: 20vw;
				height: 20vw;
				border-radius: 100%;
			}
			
		}
		.right{
			width: 70vw;
			.username{
				font-size: 36upx;
				color: #000;
			}
			.signature{
				color: #909399;
				font-size: 28upx;
			}
		}
		.hearIcon{
			width: 40upx;
			.icon{
				color: #cecece;
			}
		}
		
	}
</style>
